package com.linwen.excise.leetcode;

/**
 * @ClassName _263丑数
 * @Description TODO
 * @Author zero
 * @DATE 2024/9/22 2:44 AM
 * @Version 1.0
 */
public class _263丑数 {
    public static void main(String[] args) {
        _263丑数 inst = new _263丑数();
        System.out.println(inst.isUgly(6));
    }

    public boolean isUgly(int n) {
        if (n <= 0) {
            return false;
        }
        int[] arr = new int[]{2, 3, 5};
        for (int i = 0; i < arr.length; i++) {
            while (n % arr[i] == 0) {
                n = n / arr[i];
            }
        }
        return n == 1;
    }
}
